package com.lsc.www.day09.hm;

import java.util.Scanner;

public class Test20 {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        boolean bl = true;
        while (bl) {
            System.out.println("请输入年份");
            int a = s.nextInt();
            while (true) {
                if (a < 0) {
                    System.out.println("您输入的年份有误!(年份必须大于0)\n请重新输入正确的年份：");
                    a = s.nextInt();
                    continue;
                }
                break;
            }
            System.out.println("请输入月份");
            int b = s.nextInt();
            while (true) {

                if (b < 1 |b > 12) {
                    System.out.println("您输入的月份有误!(月份范围为1-12)\n请重新输入正确的月份：");
                    b = s.nextInt();
                }
                break;
            }
            while (true) {
                if (a % 4 == 0) {
                    switch (b) {
                        case 1:
                            System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                            break;
                        case 2:
                            System.out.println(a + "年" + b + "月" + "有" + 29 + "天");
                            break;
                        case 3:
                            System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                            break;
                        case 4:
                            System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                            break;
                        case 5:
                            System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                            break;
                        case 6:
                            System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                            break;
                        case 7:
                            System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                            break;
                        case 8:
                            System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                            break;
                        case 9:
                            System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                            break;
                        case 10:
                            System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                            break;
                        case 11:
                            System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                            break;
                        case 12:
                            System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                            break;
                    }
                }
                    if (a % 4 != 0) {
                        switch (b) {
                            case 1:
                                System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                                break;
                            case 2:
                                System.out.println(a + "年" + b + "月" + "有" + 28 + "天");
                                break;
                            case 3:
                                System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                                break;
                            case 4:
                                System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                                break;
                            case 5:
                                System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                                break;
                            case 6:
                                System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                                break;
                            case 7:
                                System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                                break;
                            case 8:
                                System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                                break;
                            case 9:
                                System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                                break;
                            case 10:
                                System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                                break;
                            case 11:
                                System.out.println(a + "年" + b + "月" + "有" + 30 + "天");
                                break;
                            case 12:
                                System.out.println(a + "年" + b + "月" + "有" + 31 + "天");
                                break;
                        }

                    }

                System.out.println("是否再次查询?0/1");
                int y = s.nextInt();
                if (y == 1) {
                    bl = false;
                }
                break;
            }
        }
    }
}
